<?php

/**
 * Contains a class to define a Product object to describe a product for sale.
 *
 * PHP Version 5
 *
 * @category BuyLocal
 * @package  BuyLocal
 * @author   Kevin Fodness <kevin.fodness@gmail.com>
 * @author   Mike Pennisi <mpennisi@andrew.cmu.edu>
 * @author   Aaron Ryden <aryden@gmail.com>
 * @license  http://opensource.org/licenses/gpl-license.php GNU Public License
 * @link     http://code.google.com/p/buylocalopensourcerensselaer/
 */
 
/**
 * A class to define a Product object to describe a product for sale.
 *
 * @category BuyLocal
 * @package  BuyLocal
 * @author   Kevin Fodness <kevin.fodness@gmail.com>
 * @author   Mike Pennisi <mpennisi@andrew.cmu.edu>
 * @author   Aaron Ryden <aryden@gmail.com>
 * @license  http://opensource.org/licenses/gpl-license.php GNU Public License
 * @link     http://code.google.com/p/buylocalopensourcerensselaer/
 */ 
class Product
{
    /**
     * The database unique ID for the product.
     *
     * @access public
     * @var int       Corresponds to products.productid
     */
    public $id;
    
    /**
     * The store unique ID for the store selling the product.
     *
     * @access public
     * @var int       Corresponds to products.storeid.  FK on stores.storeid.
     */
    public $storeId;

    /**
     * The name of the product.
     *
     * @access public
     * @var string    Corresponds to products.name
     */
    public $name;
    
    /**
     * The description for the product.
     *
     * @access public
     * @var string    Corresponds to products.description
     */
    public $description;
    
    /**
     * The price of the product.
     *
     * @access public
     * @var float     Corresponds to products.price
     */
    public $price;
    
    /**
     * The UNIX timestamp for the date and time the product was added.
     *
     * @access public
     * @var int       Corresponds to products.dateadded
     */
    public $dateAdded;
    
    /**
     * The view count for the product.
     *
     * @access public
     * @var int       Corresponds to products.views
     */
    public $views;
    
    /**
     * A ProductCondition object describing the condition of the product.
     *
     * @access public
     * @var object    Corresponds to products.conditionid
     */
    public $condition;
    
    /**
     * A boolean flag for whether the product is sold online or not.
     *
     * @access public
     * @var bool      Corresponds to products.issoldonline
     */
    public $isSoldOnline;
    
    /**
     * The manufacturer of the product.
     *
     * @access public
     * @var string    Corresponds to manufacturerers.name
     */
    public $manufacturer;
    
    /**
     * The model of the product.
     *
     * @access public
     * @var string    Corresponds to models.name
     */
    public $model;

    /**
     * An array of Tag objects describing the product's tags.
     *
     * @access public
     * @var array     Corresponds to producttags
     */
    public $tags;
    
    /**
     * Constructor function.  Populates variables based on parameters.
     *
     * @param int    $id           The unique ID for this product.
     * @param int    $storeId      The store ID selling the product.
     * @param string $name         The name of the product.
     * @param string $description  The description of the product.
     * @param float  $price        The price of the product.
     * @param int    $dateAdded    The date and time the product was added.
     * @param int    $views        The view count for the product.
     * @param object $condition    The condition of the product.
     * @param bool   $isSoldOnline Whether the product is sold online or not.
     * @param string $manufacturer The name of the product's manufacturer.
     * @param string $model        The product's model name.
     * @param array  $tags         The product's tags.
     *
     * @access public
     * @return null
     */
    public function __construct($id = null, $storeId = null, $name = null,
        $description = null, $price = null, $dateAdded = null, $views = null,
        $condition = null, $isSoldOnline = null, $manufacturer = null,
        $model = null, $tags = null
    ) {
        $this->id           = $id;
        $this->storeId      = $storeId;
        $this->name         = $name;
        $this->description  = $description;
        $this->price        = $price;
        $this->dateAdded    = $dateAdded;
        $this->views        = $views;
        $this->condition    = $condition;
        $this->isSoldOnline = $isSoldOnline;
        $this->manufacturer = $manufacturer;
        $this->model        = $model;
        $this->tags         = $tags;
    }
}

?>